﻿using System;
using System.Drawing;

namespace ConfigurationSettings
{
    /// <summary>
    /// Class structure for holding color and font settings for file and directory items.
    /// </summary>
    [Serializable]
    public class ItemSettings
    {

        /// <summary>
        /// Settings for plain display of items.
        /// </summary>
        public SubItemSettings PlainSettings { get; set; }

        /// <summary>
        /// Settings for MouseOver display of items.
        /// </summary>
        public SubItemSettings MouseOverSettings { get; set; }

        /// <summary>
        /// Settings for Selected display of items.
        /// </summary>
        public SubItemSettings SelectedSettings { get; set; }

        /// <summary>
        /// Settings for Selected MouseOver display of items.
        /// </summary>
        public SubItemSettings SelectedMouseOverSettings { get; set; }

        /// <summary>
        /// Constructor for instatiating and initializing settings objects.
        /// </summary>
        public ItemSettings()
        {
            PlainSettings = new SubItemSettings();
            MouseOverSettings = new SubItemSettings();
            SelectedSettings = new SubItemSettings();
            SelectedMouseOverSettings = new SubItemSettings();
        }
    }

    /// <summary>
    /// Class for holding color and font settings for column items.
    /// </summary>
    [Serializable]
    public class ColumnExtendedProperties
    {
        public SubItemSettings PlainSettings { get; set; }
        public SubItemSettings HighlightSettings { get; set; }

        public ColumnExtendedProperties()
        {
            PlainSettings = new SubItemSettings();
            HighlightSettings = new SubItemSettings();
        }
    }

    [Serializable]
    public class SubItemSettings
    {

        public ColorSetting NameColors { get; set; }

        public ColorSetting SizeColors { get; set; }

        public ColorSetting DateColors { get; set; }

        public Font Font { get; set; }

        public Color FontColor { get; set; }

        public SubItemSettings()
        {
            NameColors = new ColorSetting();
            SizeColors = new ColorSetting();
            DateColors = new ColorSetting();

            Font = new Font("Courier New", 9.75F, FontStyle.Regular);
            FontColor = Color.FromKnownColor(KnownColor.ControlText);
        }
    }

    [Serializable]
    public class ColorSetting
    {
        //Will hold the various color settings for the LinearGradientBrush
        float _direction;

        public Color Color1 { get; set; }
        public Color Color2 { get; set; }
        public float Direction
        {
            get
            {
                if (_direction >= 180.000f)
                {
                    return 179.99F;
                }
                if (_direction <= 0.000f)
                {
                    return 0.01F;
                }
                return _direction;
            }

            set
            {
                _direction = value;
            }
        }

        public ColorSetting()
        {
            Color1 = Color.White;
            Color2 = Color.White;
            Direction = 0.1F;
        }

    }

}
